package com.heishitech.face.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.*;

/**
 * @author Sheeper
 * @date 2017/10/24.
 */

@Controller
public class IndexController {

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "/", method = RequestMethod.GET)
    @ResponseBody
    public String index() {
        return "Hello, face recognition interface";
    }

    @RequestMapping("/camera")
    public String camera() {
        return "camera";
    }

    @RequestMapping("/add")
    public String add() {
        return "addUser";
    }

    @RequestMapping("/delete")
    public String delete() {
        return "deleteUser";
    }

    @RequestMapping("/find")
    public String find() {
        return "findUser";
    }

    @RequestMapping(path = "/grade/check/{id}", method = RequestMethod.GET)
    public String index(HttpServletRequest request, @PathVariable("id") String id) {
        HttpSession session = request.getSession();
        session.setAttribute("id", id);
        System.out.println("id==" + session.getAttribute("id"));
        return "index";
    }
}
